<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        "use strict";
        let web={
            name:"唐玮",
            age:22
        };
        //创建一个代理类,直接可以操作代理类，不用操作对象了

        let proxy=new Proxy(web,{
            get(obj,properties){
               
             return obj[properties];
            },
            set(obj,properties,value){
               obj[properties]=value;
               //严格模式下还要返回return true,不然报错
               return true;
            }
        });
        proxy.age=250;
        console.log(proxy.name);
        console.log(proxy.age);
    </script>
</body>
</html>